﻿using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Reflection;
using IDAL;
using Model;

namespace BLL
{
    public class JointingFailure : BaseService<JointingFailureInfo>
    {
        private static readonly IJointingFailure dal = DALFactory.DataAccess.CreateJointingFailure();

        public override void SetCurrentRepository()
        {
            CurrentRepository = dal;
        }

        public IList<JointingFailureInfo> JointingFailure_GetbyMan()
        {
            return dal.JointingFailure_GetbyMan();
        }

        public IList<JointingFailureInfo> JointingFailure_GetbySMT()
        {
            return dal.JointingFailure_GetbySMT();
        }

        public IList<JointingFailureInfo> JointingFailure_GetbyApp()
        {
            return dal.JointingFailure_GetbyApp();
        }

        public IList<JointingFailureInfo> JointingFailure_GetbyQCFix()
        {
            return dal.JointingFailure_GetbyQCFix();
        }

        public IList<JointingFailureInfo> JointingFailure_GetbyPack()
        {
            return dal.JointingFailure_GetbyPack();
        }

        public JointingFailureInfo JointingFailure_GetbyTypeAndName(string failureType, string failureName)
        {
            return dal.JointingFailure_GetbyTypeAndName(failureType, failureName);
        }

        public string RepairPath_GetbyQCPackCheck_FailureName(string failureName)
        {
            JointingFailureInfo jfi= dal.JointingFailure_GetbyTypeAndName("Pack", failureName);
            if (!string.IsNullOrEmpty(jfi.FailureName))
            {
                return jfi.RepairPath;
            }
            else
            {
                return null;
            }
        }
    }
}
